<?php

$filesContainer = "__common.js";
$files = array(
	"jquery.identify.js",
	"jquery.inherit.js",

	"Formius.js",

	"Helper.js",
	"Debug.js",

	"Element/Value.js",
	"Element/Abstract.js",

	"Element/Button.js",
	"Element/Button/Submit.js",
	"Element/Button/Reset.js",

	"Element/Text.js",
	"Element/Text/Combobox.js",
	"Element/Text/Date.js",
	"Element/Text/Memo.js",
	"Element/Text/Number.js",

	"Element/Select.js",
	"Element/Checkbox.js",
	"Element/Radio.js",

	"Element/Container.js",
	"Element/Container/Group.js",
	"Element/Container/Form.js",
	"Element/Container/Repeat.js",
	"Element/Container/Repeat/Row.js",
	"Element/Container/Repeat/Row/Template.js",
	"Element/Container/Repeat/Control.js",


	"Validator/Abstract.js",
	"Validator/Factory.js",
	
	"Validator/Container.js",
	"Validator/IsNumber.js",

	"Validator/RegExp.js",
	"Validator/RegExp/IsEmail.js",
	"Validator/RegExp/IsUrl.js",
	"Validator/RegExp/IsDate.js",

	"Validator/Length.js",
	"Validator/Length/Min.js",
	"Validator/Length/Max.js",
	"Validator/Length/NotEmpty.js",
	"Validator/Length/Equal.js",

	"Validator/RequiredMultiselect.js",

	/* Необходимо избавиться от этого */
	"Validator/NotRequired/Scalar.js",
	"Validator/NotRequired/Multiselect.js",

	"Validator/Compare/Abstract.js",
	"Validator/Compare/GreatThen.js",
	"Validator/Compare/GreatThenEqual.js",
	"Validator/Compare/IsEqual.js",
	"Validator/Compare/LessThen.js",
	"Validator/Compare/LessThenEqual.js",

	"Validator/Count/Abstract.js",
	"Validator/Count/Min.js",
	"Validator/Count/Max.js",
	"Validator/Count/Equal.js",
);


$resultContainer = @file_get_contents($filesContainer);
$result = "";
foreach($files as $file) {
	$fileContent = trim(@file_get_contents($file));
	$result .=  ($fileContent != ''? $fileContent: 'alert("File «' . $file. '» not found");') . "\n";
}
$result = str_replace('/*** {include classes} ***/', $result, $resultContainer);
header('Content-type: text/javascript; charset=UTF-8');
print($result);

//file_put_contents("JZ.js", $result);


?>